package com.example.bootstudy.bean;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author XiongJianLin
 * @date Created in 2022/5/7 17:35
 */
//@Component

/**
 * tips: use @ConfigurationProperties only if this class is a bean and is in the ioc containe
 * 当使用第三方的组件，或者Car不在容器中可以在自定义配置中使用@EnableConfigurationProperties 注解，
 * 见{@link com.example.bootstudy.autoconfigure.MyConfig}
 */
@ConfigurationProperties(prefix = "mycar") // Automatically get the value from the configuration file.
public class Car {
    private String brand;
    private Integer price;

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }
}
